<!DOCTYPE html>
<html lang="en">

<head>
  <title>Ch02-07 Alert input</title>
</head>

<body>
  <h1>Alert Input</h1>
  <p>
    <input type="text" id="alertInputText" value="Alert!">
    <button onclick="doShowAlert();">Show Alert</button>
  </p>

  <script>
    function doShowAlert() {
      var element = document.getElementById("alertInputText");
      var message = element.value;
      alert(message);
    }
  </script>
</body>

</html>